Find and Replace |
|
1. Component parts of Find/Replace box
2. Regular expressions
3. Search build into toolbar
1. Component parts of Find/Replace box:
Find/Replace dialog box makes possible for you to search for and replace specified text in the current pane of Visual Comparer. Find/Replace box works in modeless mode. Therefore you can not only make find and replace but also make editing of the text during of the find and replace.
Search controls: | |
Find What - specifies the text string to search for; |
|
Replace with - specifies the replacement text; |
|
Find Next - finds the next occurrence of the string you typed in the Find what box. This button is not enabled until you type text in the Find what box; |
|
Mark All (Find box only) - makes search through all text in current pane and set bookmarks on the lines in that requered find text has been found; |
|
Replace - changes the selected text to the text in the Replace with box. If you want to leave the selected text unchanged and move to the next occurrence, choose the Find Next button; |
|
Replace All - finds and replaces all instances of the text in the Find What box with the text in the Replace With box. You can undo the replacements by choosing the Undo command. |
Search options: | |
Match whole word only - locates distinct occurrences of words, not groups of characters inside words; |
|
Match Case - locates text that exactly matches the combination of uppercase and lowercase letters you type in the Find What box; |
|
Regular expression - makes it possible for you to use regular expressions in your search/replace text with a special character sequence. If you select the Regular Expression check box in the Find/Replace dialog box, you can build a search or replacement string using the Regular Expressions. |
|
Direction to up - current direction of the search is up; |
|
Direction to down - current direction of the search is down. |
2. Regular expressions:
With the advanced find and replace capabilities of the text editor, you can search for literal strings or use regular expressions to find words or characters. You can use regular expressions with both the Find and Replace commands. In the replacement string you can use tagged regular expressions. Each occurrence of a tagged expression (enclosed in brackets ( and )) is numbered according to its order in the Find What text box, and its replacement expression is \n, where 1 corresponds to the first tagged expression, 2 to the second, and so on. There may be up to nine tagged expressions. Also you can uses whole found string as one tagged expression - \0.
For example to match html tag pairs one could use something like:
"<\s*(tagname)[^>]*>(.*?)<\s*/tagname\s*>"
In this case $1 will contain the tag name and $2 - the text between the tag pairs.
The following table shows regular expressions available in Find/Replace box of Visual Comparer:
Regular expression |
Description |
---|---|
\w | Any alphanumeric string [a–zA–Z0–9]+. The string does not need to be bounded by white space or appear at the beginning or the end of a line. |
\d | Any decimal digit [0–9]+. |
. | (Period) Any single character. |
\s | One blank symbol (tab or space). |
\l | Any lower case character a-z. Other characters may also be included depending upon the locale. |
\u | Any upper case character A-Z. Other characters may also be included depending upon the locale. |
[ ] | Any one of the characters contained in the brackets, or any of an ASCII range of characters separated by a hyphen (-). For example, b[aeiou]d matches bad, bed, bid, bod, and bud, and r[eo]+d matches red, rod, reed, and rood, but not reod or roed. x[0-9] matches x0, x1, x2, and so on. If the first character in the brackets is a caret (^), then the regular expression matches any characters except those in the brackets. |
[^] | Any character except those following the caret (^) in the brackets, or any of an ASCII range of characters separated by a hyphen (-). For example, x[^0-9] matches xa, xb, xc, and so on, but not x0, x1, x2. |
^ | The beginning of a line. |
$ | The end of a line. |
* | None or more of the preceding characters or expressions. For example, ba*c matches bc, bac, baac, baaac. |
+ | At least one or more of the preceding characters or expressions. For example, ba+c matches bac, baac, baaac, but not bc. |
{N} {N,M} |
When it is necessary to specify the minimum and maximum number of repeats explicitly, the bounds operator "{}" may be used, thus "a{2}" is the letter "a" repeated exactly twice, "a{2,4}" represents the letter "a" repeated between 2 and 4 times, and "a{2,}" represents the letter "a" repeated at least twice with no upper limit. |
3. Search build into toolbar:
Visual Comparer have light-weight search combobox that build into the main toolbar:
For search with help of this combobox, simply activate it (Alt+A keyboard combination), type search text into the edit field and press F3 or Enter. Also, you can toggle between normal and regular expression types of searches using toolbar button . If you wish invoke Find/Replace dialog box itself, press Ctrl+F or toolbar button .